SYS_NAME=test

MAINPATH=$(shell /bin/pwd)
BINARY=binary

INCLUDES=-I$(MAINPATH)/headers
vpath %.cpp $(MAINPATH)/sources
vpath %.cpp $(MAINPATH)/tests

SYSTEM_OBJECTS=$(BINARY)/ClientTransferSession.o \
			   $(BINARY)/TcpClientTransferSession.o \
			   $(BINARY)/FileDriver.o \
			   $(BINARY)/FileBuffer.o
			   
UNITTEST_OBJECTS=$(BINARY)/server_test.o

CLIENT_UNITTEST_OBJECTS=$(BINARY)/client_test.o

CXXFLAGS=$(INCLUDES) -g
LDFLAGS= 
MKDIR=mkdir
 
all : $(BINARY) $(SYS_NAME) assist_test

$(BINARY): 
	$(MKDIR) $(BINARY)
    
$(SYS_NAME): $(SYSTEM_OBJECTS) $(UNITTEST_OBJECTS)
	g++ -o $(SYS_NAME) $(SYSTEM_OBJECTS) $(UNITTEST_OBJECTS) $(LDFLAGS)
	
assist_test: $(SYSTEM_OBJECTS) $(CLIENT_UNITTEST_OBJECTS)
	g++ -o assist_test $(SYSTEM_OBJECTS) $(CLIENT_UNITTEST_OBJECTS) $(LDFLAGS)
    
$(BINARY)/%.o : %.cpp 
	g++ $(CXXFLAGS) -o $@ -c $<
    
clean:
	rm -rf $(SYS_NAME) $(BINARY) assist_test
